﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BASE;
using ENT;
using BUS;

public partial class xemdiem : System.Web.UI.Page
{
    public int count = 1;
    protected void Page_Load(object sender, EventArgs e)
    {
        //check dang nhap
        if (Utils.getStringSession("masv") == "")
        {
            Response.Redirect("/");
        }
        entSinhVien entSV = new entSinhVien();
        busSinhVien busSV = new busSinhVien();
        entSV = busSV.getSinhVienByMaSV(Utils.getStringSession("masv"));
        lb_masv.Text = entSV.MaSinhVien;
        lb_ten.Text = entSV.Ten;
        lb_lop.Text = entSV.MaLop;
        lb_ngaysinh.Text = entSV.NgaySinh;

        //lay diem tbtl
        busDiem busD = new busDiem();
        List<entDiem> lst = new List<entDiem>();
        lst = busD.getDiemTBTL(Utils.getStringSession("masv"));
        if (lst.Count > 0)
        {
            lb_dtbtl.Text = lst[0].Diem;
        }

    }

    protected void btn_xem_Click(object sender, EventArgs e)
    {
        Diem_DiemControl C2 = (Diem_DiemControl)LoadControl("~/diem/DiemControl.ascx");
        C2.masv = Utils.getStringSession("masv");
        C2.nam = txt_nam.Text;
        C2.count = 1;
        pn_re.Controls.Add(C2);
    }
    protected void link_xem_Click(object sender, EventArgs e)
    {
        List<entDiem> lst = new List<entDiem>();
        busDiem busDiem = new busDiem();
        lst = busDiem.getNamHocHocKy(Utils.getStringSession("masv"));
        Diem_DiemControl C2;
        int count = 1;
        foreach (entDiem item in lst)
        {
             C2 = (Diem_DiemControl)LoadControl("~/diem/DiemControl.ascx");
             C2.masv = Utils.getStringSession("masv");
             C2.nam = item.NamHoc + item.HocKy ;
             C2.count = count;
             pn_re.Controls.Add(C2);
             count += C2.max;
        }
    }
}